public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
        /*匿名内部类
        CreateCat createCat = new CreateCat() {
            public Cat create(String name, int age) {
                return new Cat(name, age);
            }
        };
         */
        // 使用Lambda表达式
        CreateCat createCat = (String name, int age) -> new Cat(name, age);
        createCat=(name, age) -> new Cat(name, age);
        createCat=(name, age) -> new Cat();
        //方法引用,必须前后参数一致
        createCat=(Cat::new);
        Cat abilitying = createCat.create("Abilitying", 12);
    }
}

interface CreateCat{
    Cat create(String name,int age);
}

class Cat {
    String name;
    int age;

    Cat(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Cat() {

    }
}